package com.tanhua.dubbo.api.db;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanhua.dubbo.api.mapper.OptionMapper;
import com.tanhua.model.db.Option;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Version 1.0
 * @Author aao
 * @Date 2022/2/21 16:55
 * @Description 选项服务接口实现类
 */
@DubboService
public class OptionApiImpl implements OptionApi{

    @Autowired
    private OptionMapper optionMapper;

    /**
     * 根据问题id查询选项
     * @param questionId
     * @return
     */
    @Override
    public List<Option> findByUserQuestionId(Long questionId) {
        LambdaQueryWrapper<Option> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Option::getQuestionId,questionId);
        return optionMapper.selectList(queryWrapper);
    }
}
